package exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice //处理全局异常类
public class AllException {

	
	/**
	 * 全局项目的异常处理点 
	 * @param exception
	 * @return ModelAndView
	 */
	@ExceptionHandler(value= {IllegalArgumentException.class})
	public ModelAndView testRunTimeException(Exception exception) {
		ModelAndView moAndView=new ModelAndView();
		moAndView.addObject("errorinfo", exception.getMessage());
		moAndView.setViewName("error");
		return moAndView;
	}
	
		
}
